package ua.mihaylenko.app.data.str 
{
	import flash.utils.Dictionary;
	import ua.mihaylenko.app.interfaces.IUIData;
	/**
	 * ...
	 * @author Mihaylenko A.L.
	 */
	public class DataStrings implements IUIData
	{
		private var _dctStrings:Dictionary;
		private var _sLanguage:String;
		public function DataStrings() 
		{
			
		}
		public function set language(sVal:String):void { _sLanguage = sVal; }
		public function get language():String { return _sLanguage; }
		public function getStringById(iId:uint):String { return _dctStrings[_sLanguage + '_' + iId.toString()]; }
		/* INTERFACE IUIData */
		public function innitData(xConf:XML):void
		{
			trace('innit data strings');
			_sLanguage = xConf.@defaultLanguage;
			_dctStrings = new Dictionary();
			for each(var xNode:XML in xConf.elements()) {
				for each(var xNodeLanValue:XML in xNode.elements()) {
					
					_dctStrings[xNodeLanValue.localName() + '_' + xNode.@id] = xNodeLanValue.@value;
				}
			}
		}
	}

}